#include "QueueUsingTwoStack.h"


void CQueue::appendTail(const T& node)
{
	if(stack2.size()==0)
		stack1.push(node);
	else
	{
		while(stack2.size() > 0)
		{
			T tempNode = stack2.pop();
			stack1.push(T);
		}
		stack1.push(node);
	}
}

T CQueue::deleteHead()
{
	if(stack1.size()==0)
	{
		if(stack2.size()==0)
			throw new exception("The queue is empty!");
		return stack2.pop();
	}
	else
	{
		while(stack1.size() > 0)
		{
			T tempNode = stack1.pop();
			stack2.push(T);
		}
		return stack2.pop();
	}
}